package domain.controller;

import java.io.IOException;
import java.util.Date;
import java.util.List;

import javax.jdo.PersistenceManager;
import javax.jdo.Query;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import domain.data.QnAPersistenceManager;
import domain.model.Whois;
import domain.service.Utils;

@SuppressWarnings("serial")
public class WhoisIndexServlet extends HttpServlet {
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        resp.setContentType("text/html");
        resp.getWriter().println("Hello, world");
        Date date_cache = new Date(new Date().getTime()+60*60*1000);
		
		resp.setHeader( "Cache-Control", "public, max-age=30");
		resp.setHeader( "Expires", date_cache.toGMTString() );
        req.setAttribute("title", "Whois lookup");
		req.setAttribute("description", "Use Our Free Whois Lookup Database To Search For & Reserve Your Domain Today at  "+Utils.ValidDomain());
		req.setAttribute("keyword", "whois,whois lookup,Domain name information,  Server information, Web site analysis, website traffic details, Website backlinks website IP, website ranking info");
        
        try {
			req.getRequestDispatcher("/whois_index.jsp").forward(req, resp);
		} catch (ServletException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
    }
}
